package cn.ex.ymcc.listener;

import cn.ex.ymcc.service.ISysDicService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * @Author: ZeWangmu
 * @Date: 2022/08/16/14:41
 * @Description:
 */
@WebListener
@Slf4j
public class SysDicLintener implements ServletContextListener {
    @Autowired
    private ISysDicService iSysDicService;

    /**
     * 容器启动，开启一个新的线程查询数据字典
     * @param sce
     */
    @Override
    public void contextInitialized(ServletContextEvent sce) {
        new Thread(new Runnable() {
            @Override
            public void run() {
                iSysDicService.initialize();
            }
        }).start();
    }
}
